package com.kerrykidz.membership.dao.model;

import java.util.Calendar;
import java.util.Date;

import org.apache.commons.lang3.StringUtils;

import com.kerrykidz.system.util.DateUtil;
import com.rdp.framework.core.model.MyBatisSuperModel;
import com.rdp.framework.exception.RDPException;
import com.rdp.util.time.DateFormatUtil;

public class CusMemEntity extends MyBatisSuperModel{
	
	private String pkMemId;
	private String fkBranId;
	private String memNo;
	private String status;
	private String familyId;
	private Date startDate;
	private Date endDate;
	private String memType;
	private String memName;
	private String sex;
	private String isVip;
	private Date birthday;
	private String country;
	private String receivePwd;
	private String note;
	private String memo;
	private Date imageTime;
	private String imagePath;
	private String canConsume;
	private String signDisclaimer;
	private String recommended;
	private Double balance;
	private Date regTime;
	private String delFlag;
	private String modiBy;
	private Date modiTime;
	private String telnum;
	
	/*************************以下是扩展信息*************************/
	// 会员卡编号
	private String memberCardId;
	// 会员卡名称
	private String memberCardName;
	// 关联销售
	private String fkSales;
	// 关联销售
	private String salesName;
	// 国家名称
	private String countryDesc;
	// 指纹：主手指
	private String fing1;
	// 指纹：副手指
	private String fing2;
	// 指纹：指纹1对应的手指 左手拇指开始依次编号为1-5，右手拇指开始依次编号为6-10
	private Integer ftype1;
	// 指纹：指纹2对应的手指 左手拇指开始依次编号为1-5，右手拇指开始依次编号为6-10
	private Integer ftype2;
	// 年龄
	private String age;
	//生日用于页面传参
	private String birthdayPage;
	
	private String contactPath;

	// 会员卡有效总天数
	private String totalDay;
	// 会员卡剩余天数
	private String remainDay;
	// 会员卡价格
	private Double cardPrice;
	// 订单ID
	private String fkOrderId;
	
	//黑名单原因借用字段
	private String blackReason;
	private String isBlack;
	
	//会员停卡记录借用字段
	private String suspendStart;
	private String suspendEnd;
	private String suspendReason;
	private String fkMngFile;

	// 查询订单总额
	private Double amount;

	private String vipBirthday;// 会员生日

	private String conInfo;
	private String holdDate;

	// 会员类型
	private String prdName;

	// 进出场时间
	private String inTime;
	private String outTime;
	
	//报表 - 会员
	private String fkPrdId;
	private String membershipType;//会籍类型
	private String contactInfo;//联系信息
	private String isVipDes;//1是0否
	private String startTime;//开始时间
	private String endTime;//结束时间
	private double sumValue;//储值金额
	private Date payTime;
	private String payTimeStr;
	private String modiTimeStr;
	//控制停卡
	private String isStopCard;
	private String isUniq;

	//可同时进场的监护人数量
	private int guaCnt;
	//成人票数量
	private int guaTicketCount;
	
	//单次票数量
	private boolean isSingleTicket;
	public boolean getIsSingleTicket() {
		return isSingleTicket;
	}

	public void setIsSingleTicket(boolean isSingleTicket) {
		this.isSingleTicket = isSingleTicket;
	}

	public int getGuaTicketCount() {
		return guaTicketCount;
	}

	public void setGuaTicketCount(int guaTicketCount) {
		this.guaTicketCount = guaTicketCount;
	}

	public int getGuaCnt() {
		return guaCnt;
	}

	public void setGuaCnt(int guaCnt) {
		this.guaCnt = guaCnt;
	}

	public String getIsStopCard() {
		return isStopCard;
	}

	public void setIsStopCard(String isStopCard) {
		this.isStopCard = isStopCard;
	}

	public String getIsUniq() {
		return isUniq;
	}

	public void setIsUniq(String isUniq) {
		this.isUniq = isUniq;
	}

	public String getValidDate() {
		if (this.startDate != null && this.endDate != null) {
			return DateFormatUtil.format(this.startDate, "yyyy/MM/dd") + "~" + DateFormatUtil.format(this.endDate, "yyyy/MM/dd");
		}
		return "";
	}
	
	public String getVipBirthday() {
			this.vipBirthday="";
			if (this.birthday != null) {
				return  DateFormatUtil.format(this.birthday, "yyyy.MM.dd");
			}
			return vipBirthday;
	}
	public void setVipBirthday(String vipBirthday) {
		this.vipBirthday = vipBirthday;
	}

	public String getInTime() {
		return inTime;
	}

	public void setInTime(String inTime) {
		this.inTime = inTime;
	}

	public String getOutTime() {
		return outTime;
	}

	public void setOutTime(String outTime) {
		this.outTime = outTime;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public String getSuspendStart() {
		return suspendStart;
	}

	public void setSuspendStart(String suspendStart) {
		this.suspendStart = suspendStart;
	}

	public String getSuspendEnd() {
		return suspendEnd;
	}

	public void setSuspendEnd(String suspendEnd) {
		this.suspendEnd = suspendEnd;
	}

	public String getSuspendReason() {
		return suspendReason;
	}

	public void setSuspendReason(String suspendReason) {
		this.suspendReason = suspendReason;
	}

	public String getFkMngFile() {
		return fkMngFile;
	}

	public void setFkMngFile(String fkMngFile) {
		this.fkMngFile = fkMngFile;
	}

	public String getBlackReason() {
		return blackReason;
	}

	public void setBlackReason(String blackReason) {
		this.blackReason = blackReason;
	}

	public void setBirthdayPage(String birthdayPage) {
		this.birthdayPage = birthdayPage;
		try {
			this.birthday = DateFormatUtil.convertStrToDate(this.birthdayPage, "yyyy-MM-dd");
		} catch (RDPException e) {
			e.printStackTrace();
		}
	}

	public String getAge() {
		if (birthday == null)
			return null;
		Calendar cal = Calendar.getInstance();

		int yearNow = cal.get(Calendar.YEAR);
		int monthNow = cal.get(Calendar.MONTH) + 1;
		int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH);

		cal.setTime(birthday);
		int yearBirth = cal.get(Calendar.YEAR);
		int monthBirth = cal.get(Calendar.MONTH) + 1;
		int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);

		int age = yearNow - yearBirth;

		if (monthNow <= monthBirth) {
			if (monthNow == monthBirth) {
				if (dayOfMonthNow < dayOfMonthBirth) {
					age--;
				}
			} else {
				// monthNow>monthBirth
				age--;
			}
		}

		this.age = age + "";
		return this.age;
	}

	public String getStartDatePage() {
		if (this.startDate != null) {
			return DateFormatUtil.format(this.startDate, "yyyy.MM.dd");
		}
		return "";
	}
	
	public String getEndDatePage() {
		if (this.endDate != null) {
			return DateFormatUtil.format(this.endDate, "yyyy.MM.dd");
		}
		return "";
	}
	
	public String getBirthdayPage() {
		if (this.birthday != null) {
			return DateFormatUtil.format(this.birthday, "yyyy.MM.dd");
		}
		return "";
	}
	
	public String getImageTimePage() {
		if (this.imageTime != null) {
			return DateFormatUtil.format(this.imageTime, "yyyy.MM.dd");
		}
		return "";
	}
	
	public String getRegTimePage() {
		if (this.regTime != null) {
			return DateFormatUtil.format(this.regTime, "yyyy.MM.dd");
		}
		return "";
	}
	
	public String getFkSales() {
		return fkSales;
	}

	public void setFkSales(String fkSales) {
		this.fkSales = fkSales;
	}

	public String getSalesName() {
		return salesName;
	}

	public void setSalesName(String salesName) {
		this.salesName = salesName;
	}

	public String getFamilyId() {
		return familyId;
	}

	public void setFamilyId(String familyId) {
		this.familyId = familyId;
	}

	public String getMemberCardName() {
		return memberCardName;
	}

	public void setMemberCardName(String memberCardName) {
		this.memberCardName = memberCardName;
	}

	public void setAge(String age) {
		this.age = age;
	}

	public String getPkMemId() {
		return pkMemId;
	}

	public void setPkMemId(String pkMemId) {
		this.pkMemId = pkMemId;
	}

	public String getFkBranId() {
		return fkBranId;
	}

	public void setFkBranId(String fkBranId) {
		this.fkBranId = fkBranId;
	}

	public String getMemNo() {
		return memNo;
	}

	public void setMemNo(String memNo) {
		this.memNo = memNo;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getMemType() {
		return memType;
	}

	public void setMemType(String memType) {
		this.memType = memType;
	}

	public String getMemName() {
		return memName;
	}

	public void setMemName(String memName) {
		this.memName = memName;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getIsVip() {
		return isVip;
	}

	public void setIsVip(String isVip) {
		this.isVip = isVip;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getReceivePwd() {
		return receivePwd;
	}

	public void setReceivePwd(String receivePwd) {
		this.receivePwd = receivePwd;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public Date getImageTime() {
		return imageTime;
	}

	public void setImageTime(Date imageTime) {
		this.imageTime = imageTime;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public String getCanConsume() {
		return canConsume;
	}

	public void setCanConsume(String canConsume) {
		this.canConsume = canConsume;
	}

	public String getSignDisclaimer() {
		return signDisclaimer;
	}

	public void setSignDisclaimer(String signDisclaimer) {
		this.signDisclaimer = signDisclaimer;
	}

	public String getRecommended() {
		return recommended;
	}

	public void setRecommended(String recommended) {
		this.recommended = recommended;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	public Date getRegTime() {
		return regTime;
	}

	public void setRegTime(Date regTime) {
		this.regTime = regTime;
	}

	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public String getModiBy() {
		return modiBy;
	}

	public void setModiBy(String modiBy) {
		this.modiBy = modiBy;
	}

	public Date getModiTime() {
		return modiTime;
	}

	public void setModiTime(Date modiTime) {
		this.modiTime = modiTime;
	}

	public String getCountryDesc() {
		return countryDesc;
	}

	public void setCountryDesc(String countryDesc) {
		this.countryDesc = countryDesc;
	}

	public String getFing1() {
		return fing1;
	}

	public void setFing1(String fing1) {
		this.fing1 = fing1;
	}

	public String getFing2() {
		return fing2;
	}

	public void setFing2(String fing2) {
		this.fing2 = fing2;
	}

	public Integer getFtype1() {
		return ftype1;
	}

	public void setFtype1(Integer ftype1) {
		this.ftype1 = ftype1;
	}

	public Integer getFtype2() {
		return ftype2;
	}

	public void setFtype2(Integer ftype2) {
		this.ftype2 = ftype2;
	}

	public String getTelnum() {
		return telnum;
	}

	public void setTelnum(String telnum) {
		this.telnum = telnum;
	}

	public String getMemberCardId() {
		return memberCardId;
	}

	public void setMemberCardId(String memberCardId) {
		this.memberCardId = memberCardId;
	}

	public String getPrdName() {
		return prdName;
	}

	public void setPrdName(String prdName) {
		this.prdName = prdName;
	}

	public String getIsBlack() {
		return isBlack;
	}

	public void setIsBlack(String isBlack) {
		this.isBlack = isBlack;
	}
	public String getContactPath() {
		return contactPath;
	}
	public void setContactPath(String contactPath) {
		this.contactPath = contactPath;
	}
	public String getConInfo() {
		return conInfo;
	}
	public void setConInfo(String conInfo) {
		this.conInfo = conInfo;
	}
	
	public String getHoldDate() {
		if(null == this.endDate && null != this.birthday){
			return DateUtil.formatDate("yyyy-MM-dd", this.birthday);
		}else if(null != this.endDate && null == this.birthday){
			return DateUtil.formatDate("yyyy-MM-dd", this.endDate);
		}
		return holdDate;
	}
	public void setHoldDate(String holdDate) {
		this.holdDate = holdDate;
	}
	public String getRemainDay() {
		return remainDay;
	}
	public void setRemainDay(String remainDay) {
		this.remainDay = remainDay;
	}
	public Double getCardPrice() {
		return cardPrice;
	}
	public void setCardPrice(Double cardPrice) {
		this.cardPrice = cardPrice;
	}
	public String getTotalDay() {
		return totalDay;
	}
	public void setTotalDay(String totalDay) {
		this.totalDay = totalDay;
	}
	public String getFkOrderId() {
		return fkOrderId;
	}
	public void setFkOrderId(String fkOrderId) {
		this.fkOrderId = fkOrderId;
	}


	public String getFkPrdId() {
		return fkPrdId;
	}


	public void setFkPrdId(String fkPrdId) {
		this.fkPrdId = fkPrdId;
	}


	public String getMembershipType() {
		return membershipType;
	}


	public void setMembershipType(String membershipType) {
		this.membershipType = membershipType;
	}


	public String getContactInfo() {
		return contactInfo;
	}


	public void setContactInfo(String contactInfo) {
		this.contactInfo = contactInfo;
	}
	public void setIsVipDes(String isVipDes) {
		this.isVipDes = isVipDes;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	public String getIsVipDes() {
		if(StringUtils.isNotBlank(this.isVip))
			if(this.isVip.equals("1")){
				isVipDes = "是";
			}else{
				isVipDes =  "否";
			}
		return isVipDes;
	}
	public String getStartTime() {
		if(null != this.startDate)
			startTime = DateUtil.formatDate("yyyy/MM/dd", startDate);
		return startTime;
	}
	
	public String getEndTime() {
		if(null != this.endDate)
			endTime = DateUtil.formatDate("yyyy/MM/dd", endDate);
		return endTime;
	}
	public double getSumValue() {
		return sumValue;
	}
	public void setSumValue(double sumValue) {
		this.sumValue = sumValue;
	}
	public Date getPayTime() {
		return payTime;
	}
	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}
	public String getPayTimeStr() {
		if(null != this.payTime)
			payTimeStr = DateUtil.formatDate("yyyy/MM/dd", this.payTime);
		return payTimeStr;
	}
	public void setPayTimeStr(String payTimeStr) {
		this.payTimeStr = payTimeStr;
	}
	public String getModiTimeStr() {
		if(null != this.modiTime)
			modiTimeStr = DateUtil.formatDate("yyyy/MM/dd", this.modiTime);
		return modiTimeStr;
	}
	public void setModiTimeStr(String modiTimeStr) {
		this.modiTimeStr = modiTimeStr;
	}
	
}